package com.vote.common.enums;

public enum  UserTypeEnum {

    USER(0, "普通用户"),
    ADMIN(1, "管理员"),
    SUPER_ADMIN(2, "超级管理员"),
    NO_USERNAME(3, "匿名账号"),
    NO_NAME(4, "匿名用户");

    private Integer code;
    private String desc;

    UserTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static UserTypeEnum getInstance(Integer code) {
        for (UserTypeEnum item : UserTypeEnum.values()) {
            if (code.equals(item.getCode())) {
                return item;
            }
        }
        return null;
    }
}
